<html>
<?php
	header('Refresh: 1');
?>
	<head>
		<title>Parking Lot Status</title>
	</head>
	<body bgcolor="#000000">
<?php
	$connection = mysql_connect('localhost', 'root', 'johndoe333');
	mysql_select_db('PMS', $connection);
	$query = "SELECT * FROM parking_lot";
	$result = mysql_query($query);
?>

	<table border="1" bgcolor="#BBBBBB" align="center">
	<tr>
		<th>Space</th>
		<th>Status</th>
	</tr>
		
<?php	
if ($result) 
{
	while ($row = mysql_fetch_array($result))
	{
		echo '<tr>';
		echo '<td align="center">' . $row['row_id'] . '</td>';
		echo '<td align="center" bgcolor="#' . ($row['status'] ? 'FF0000">Occupied' : '00FF00">Unoccupied') . '</td>';
		echo '</tr>';
	}
}
echo '</table>';
?>
	</body>
</html>
